Determination and Control of Wellbore Fluid Level, Output Flow, and Desired Pump Operating Speed, Using a Control System for a Centrifugal Pump Disposed Within the Wellbore

ABSTRACT

A method and apparatus for determining a fluid level and/or output flow during operation of a centrifugal pump, are provided, which may be used for production of gas and/or oil from a well, and include a vector feedback model to derive values of torque and speed from signals indicative of instantaneous current and voltage drawn by the pump motor, a pump model which derives values of the fluid flow rate and the head pressure for the pump from torque and speed inputs, a pumping system model that derives, from the estimated values of the pump operating parameters, an estimated value of fluid level and other pumping system parameters. Controllers responsive to the estimated values of the pumping system parameters control the pump to maintain fluid level at the pump input, near an optimum level, or within a safe operating range and/or output flow from the pump.

CROSS-REFERENCE TO RELATED PATENT APPLICATIONS

This application is a Divisional of U.S. patent application Ser. No.12/987,706, entitled “Determination and Control of Wellbore Fluid Level,Output Flow, and Desired Pump Operating Speed, Using a Control Systemfor a Centrifugal Pump Disposed Within the Wellbore, filed Jan. 10,2011, now U.S. patent Ser. No. ______, issued on ______, 2012, which inturn is a Divisional of U.S. patent application Ser. No. 12/707,713entitled “Determination and Control of Wellbore Fluid Level, OutputFlow, and Desired Pump Operating Speed, Using a Control System for aCentrifugal Pump Disposed Within the Wellbore” filed on Feb. 18, 2010,now U.S. Pat. No. 7,869,978, issued on Jan. 11, 2011; which is aDivisional of U.S. patent application Ser. No. 11/741,412 entitled“Determination and Control of Wellbore Fluid Level, Output Flow, andDesired Pump Operating Speed, Using a Control System for a CentrifugalPump Disposed within the Wellbore” filed on Apr. 27, 2007, now U.S. Pat.No. 7,668,694, issued on Feb. 23, 2010, which in turn is aContinuation-in-Part of U.S. patent application Ser. No. 11/502,677entitled “Control System for Centrifugal Pumps”, filed on Aug. 10, 2006,now U.S. Pat. No. 7,558,699, issued on Jul. 7, 2009, which is aDivisional of U.S. patent application Ser. No. 10/656,091 entitled“Control System for Centrifugal Pumps”, filed on Sep. 5, 2003, now U.S.Pat. No. 7,117,120, which in turns claims the benefit of and/or priorityto: provisional application Ser. No. 60/429,158, entitled “SensorlessControl System for Progressive Cavity and Electric Submersible Pumps”,filed on Nov. 26, 2002; and provisional application Ser. No. 60/414,197,entitled “Rod Pump Control System Including Parameter Estimator”, filedon Sep. 27, 2002; which seven patent applications are incorporatedherein in their entirety by these references.

FIELD OF THE INVENTION

The present invention relates generally to pumping systems, and moreparticularly, to methods for determining operating parameters andoptimizing the performance of centrifugal pumps, which are rotationallydriven and characterized by converting mechanical energy into hydraulicenergy through centrifugal activity.

BACKGROUND OF THE INVENTION

Centrifugal pumps are used for transporting fluids at a desired flow andpressure from one location to another, or in a recirculating system.Examples of such applications include, but are not limited to: oil,water or gas wells, irrigation systems, heating and cooling systems,multiple pump systems, wastewater treatment, municipal water treatmentand distribution systems.

In order to protect a pump from damage or to optimize the operation of apump, it is necessary to know and control various operating parametersof a pump. Among these are pump speed, pump torque, pump efficiency,fluid flow rate, minimum required suction head pressure, suctionpressure, and discharge pressure.

Sensors are frequently used to directly measure pump operatingparameters. In many applications, the placement required for the sensoror sensors is inconvenient or difficult to access and may require thatthe sensor(s) be exposed to a harmful environment. Also, sensors add toinitial system cost and maintenance cost as well as decreasing theoverall reliability of the system.

Centrifugal pumping systems are inherently nonlinear. This presentsseveral difficulties in utilizing traditional closed-loop controlalgorithms, which respond only to error between the parameter valuedesired and the parameter value measured. Also, due to the nature ofsome sensors, the indication of the measured parameter suffers from atime delay, due to averaging or the like. Consequently, thenon-linearity of the system response and the time lag induced by themeasured values makes tuning the control loops very difficult withoutintroducing system instability. As such, it would be advantageous topredict key pump parameters and utilize each in a feedforward controlpath, thereby improving controller response and stability and reducingsensed parameter time delays.

As an example, in a methane gas well, it is typically necessary to pumpwater off to release trapped gas from an underground formation. Thisprocess is referred to as dewatering, where water is a byproduct of thegas production. The pump is operated to control the fluid level withinthe well, thereby maximizing the gas production while minimizing theenergy consumption and water byproduct.

As another example, in an oil well, it is desirable to reduce the fluidlevel above the pump to lower the pressure in the casing, therebyincreasing the flow of oil into the well and allowing increasedproduction. In practice, the fluid level is ideally reduced to thelowest level possible while still providing sufficient suction pressureat the pump inlet. The minimum required suction head pressure of a pumpis a function of its design and operating point.

Typically, centrifugal pumps are used for both oil and gas production.As fluid is removed by the pump, the fluid level within the well dropsuntil inflow from the formation surrounding the pump casing equals theamount of fluid being pumped out. It is desirable that the pump flowrate be controlled in a manner precluding the fluid level from beingreduced to a point where continued flow from the well is compromised,and/or damage to the pump could occur.

If the fluid level in the well drops too low, undesirable conditionsknown as “pump-off,” or “gas-lock,” may occur in the pump. Pump-offoccurs when the fluid level in the well has dropped to a point where thepump inlet no longer receives a steady inflow of mostly liquid fluidfrom the well. Gas-lock occurs, in wells having gas entrained in thefluid, when the fluid level has been reduced to such a low level thatfluid pressure at the pump inlet falls below a bubble-point of thefluid, at which larger volumes of free gas are released and enter thepump. Under either a pump-off or gas-lock condition, the pumping actionbecomes unstable and flow is significantly reduced, with a correspondingreduction in pumping torque and motor current being observed in anelectrical motor driven pump.

When a pump-off condition is encountered, it is necessary to slow down,or stop, pumping until the fluid level in the well has been sufficientlyreplenished, through inflow from the formation surrounding the pumpcasing to a level whereat the pump-off condition will not be immediatelyencountered upon re-starting of the pump. With a pump-off condition, itis necessary for the fluid level to rise far enough in the well that thepump inlet can once again receive sufficient inflow of mostly liquidfluid for the pump to function properly. For a gas-lock condition, it isnecessary to allow the large volume of gas which caused the gas-lockcondition to move upward in the tube, with a corresponding downwardmovement of non-gaseous fluid within the tube into the pump, so that thepump may once again function properly. Recovery from a gas-lockcondition thus also requires slowing down or stopping the pump to allowfor movement of gas and liquid within the tube.

As will be readily recognized, by those having skill in the art, ifpumping is resumed at the pumping speed which led to either the pump-offor gas-lock condition, it is likely that such a condition wouldre-occur. Unfortunately, in the past, wellbore pumping systems andcontrols did not provide a convenient apparatus or method fordetermining what the maximum pump speed should be, during recovery, inorder to preclude triggering a subsequent pump-off and/or gas-lockcondition. In the past, motor current was sometimes monitored, and thepump was simply shut down and allowed to stand idle, for a time,whenever the value of pump current dropped below a pre-determinedunder-load value of current thought to be indicative of a pump-offand/or gas-lock condition. It was then necessary to let the pump remainidle, for an undetermined length of time, so that proper conditionscould be re-established at the pump, by virtue of inflow of fluid to thewell from the surrounding structure, and/or downward flow of non-gaseousfluid within the outlet tube connected to the pump.

Knowing when to resume pumping, and knowing what reduced pump speedshould be utilized following resumption of pumping, to preclude having arecurrence of the pump-off or gas-lock condition, has been largely amatter of trial and error in the past. During the time that the pump isshut down for recovery, no revenue is being generated by the well. Inaddition, the uncertainty, in the past, with regard to avoiding apump-off or gas-lock condition, and the time and procedure involved forrecovering from such conditions, has led to undesirable wear and tear onthe pumping equipment, as well.

It is desirable, therefore, to have an improved apparatus and method fordetecting, and precluding a pump-off or gas-lock condition. It is alsodesirable to have an improved apparatus and method for recovering from apump-off and/or gas-lock. It is further desirable, to have an improvedapparatus and method which is capable of determining what a minimumfluid level in the well should be, in order to preclude a pump-offand/or gas-lock condition, together with a corresponding detection andcontrol apparatus and method for determining a pump speed which willresult in maintaining the fluid level at or near the desired minimumfluid level in the well.

Generally, in the past, the fluid level has been sensed with a pressuresensor inserted near the intake or suction side of the pump, typically1000 to 5000 feet or more below the surface. These down-hole sensors areexpensive and suffer very high failure rates, necessitating frequentremoval of the pump and connected piping to facilitate repairs.Likewise, the need for surface flow sensors adds cost to the pumpsystem. The elimination of a single sensor improves the installationcost, maintenance cost and reliability of the system.

Also, centrifugal pumps are inefficient when operating at slow speedsand/or flows, wasting electrical power. Therefore, there is a need for amethod which would provide reduced flow without sacrificing overallefficiency.

Accordingly, it is an objective of the invention to provide a method forestimating the flow and pressure of a centrifugal pump without the useof down hole sensors. Another objective of the invention is to provide amethod for determining pump suction pressure and/or fluid levels in thepumping system using the flow and pressure of a centrifugal pumpcombined with other pumping system parameters. Another objective of theinvention is to provide a method for using closed loop control ofsuction pressure or fluid level to protect the pump from damage due tolow or lost flow. Another objective of the invention is to provide amethod for improving the dynamic performance of closed loop control ofthe pumping system. Other objectives of the invention are to providemethods for improving the operating flow range of the pump, for usingestimated and measured system parameters for diagnostics and preventivemaintenance, for increasing pumping system efficiency over a broad rangeof flow rates, and for automatically controlling the casing fluid levelby adjusting the pump speed to maximize gas production from coal bedmethane wells.

The apparatus of the present invention must also be of constructionwhich is both durable and long lasting, and it should also requirelittle or no maintenance by the user throughout its operating lifetime.In order to enhance the market appeal of the apparatus of the presentinvention, it should also be of inexpensive construction to therebyafford it the broadest possible market. Finally, it is also an objectivethat all of the aforesaid advantages and objectives be achieved withoutincurring any substantial relative disadvantage.

BRIEF SUMMARY OF THE INVENTION

The disadvantages and limitations of the background art discussed aboveare overcome by the present invention. With this invention, there isprovided a method of continuously determining operational parameters ofa down hole pump used in oil, water or gas production. In oneembodiment, wherein the pump is a centrifugal pump, the pump isrotationally driven by an AC electrical drive motor having a rotorcoupled to the pump for rotating the pump element. In deep wells, it iscommon practice to use an AC electrical drive motor designed to operateat voltages that are several times that of conventional industrialmotors. This allows the motors to operate at lower currents, therebyreducing losses in the cable leading from the surface to the motor. Inthose cases, a step up transformer can be used at the surface to boostthe typical drive output voltages to those required by the motor.

In one form of the invention, a method comprises the steps ofcontinuously measuring above ground the electrical voltages applied tothe cable leading to the drive motor to produce electrical voltageoutput signals; continuously measuring above ground the electricalcurrents applied to the drive motor through the cable to produceelectrical current output signals; using a mathematical model of thecable and motor to derive values of instantaneous electrical torque fromthe electrical voltage output signals and the electrical current outputsignals; using a mathematical model of the cable and motor to derivevalues of instantaneous motor velocity from the electrical voltageoutput signals and the electrical current output signals; and usingmathematical pump and system models and the instantaneous motor torqueand velocity values to calculate instantaneous values of operatingparameters of the centrifugal pump system. In systems using a step uptransformer, electrical voltages and currents can be measured at theinput to the step up transformer and a mathematical model of the step uptransformer can be used to calculate the voltages and currents beingsupplied to the cable leading to the motor. In one embodiment, themethod is used for calculating pump flow rate, head pressure, minimumrequired suction head pressure, suction pressure, and dischargepressure. In another embodiment, used when accurate calculation of pumpflow rate is difficult or impossible, the flow rate is measured aboveground in addition to determining the motor currents and motor voltages,and the method is used to calculate head pressure, minimum requiredsuction head pressure, suction pressure, and discharge pressure.

The invention provides a method and apparatus, for deriving pump flowrate and head pressure from the drive motor and pumping unit parameterswithout the need for external instrumentation, and in particular, downhole sensors. The self-sensing control arrangement provides nearlyinstantaneous readings of motor velocity and torque which can be usedfor both monitoring and real-time, closed-loop control of thecentrifugal pump. In addition, system identification routines are usedto establish parameters used in calculating performance parameters thatare used in real-time closed-loop control of the operation of thecentrifugal pump.

In one embodiment, wherein the operating parameters are pump headpressure and flow rate, the method includes the steps of using thecalculated value of the flow rate at rated speed of the pump under thecurrent operating conditions and the instantaneous value of motor speedto obtain pump efficiency and minimum required suction head pressure.The present invention includes the use of mathematical pump and systemmodels to relate motor torque and speed to pump head pressure, flow rateand system operational parameters. In one embodiment, this is achievedby deriving an estimate of pump head pressure and flow rate from motorcurrents and voltage measurements which are made above ground. Theresults are used to control the pump to protect the pump from damage, toestimate system parameters, diagnose pumping system problems and toprovide closed-loop control of the pump in order to optimize theoperation of the pump. Protecting the pump includes detecting blockage,cavitation, and stuck pump. Comparisons of calculated flow estimates andsurface flow measurements can detect excess pump wear, flow blockage,and tubing leaks.

The operation of a centrifugal pump is controlled to enable the pump tooperate periodically, such that the pump can achieve a broad averageflow range while maintaining high efficiency. This obviates the need toreplace a centrifugal pump with another pump, such as a rod beam pump,when fluid level or flow in the well decreases over time. In accordancewith another aspect of the invention, a check valve is used to preventback flow during intervals in which the pump is turned off.

In accordance with a further aspect of the invention, an optimizingtechnique is used in the production of methane gas wherein it isnecessary to pump water off an underground formation to release the gas.The optimizing technique allows the fluid level in the well to bemaintained near an optimum level in the well and to maintain the fluidat the optimum level over time by controlling pump speed to raise orlower the fluid level as needed to maintain the maximum gas production.

This is done by measuring and/or calculating fluid flow, gas flow,casing gas pressure, and fluid discharge pressure at the surface.Selected fluid levels are used to define a sweet zone. This can be donemanually or using a search algorithm. The search algorithm causes thefluid level to be moved up and down, searching for optimum performance.The search algorithm can be automatically repeated at preset intervalsto adjust the fluid level to changing well conditions.

The invention also provides an improved method and apparatus fordetermining a fluid level in a wellbore, or the like, where the wellboreor the like extends downward from a surface and has a centrifugal pumpdisposed therein for transferring fluid within the wellbore, or thelike, by determining a zero-flow input speed to the centrifugal pump atwhich output flow from the centrifugal pump is substantially zero, andusing the zero-flow input speed to calculate the fluid level in thewellbore, or the like.

By the term wellbore, or “wellbore or the like”, the inventors mean toinclude all applications having structural and/or functional similarityto a wellbore. Such structure would include, but not be limited to:wellbores; well casings; fluid tanks; and reservoirs.

The invention may be used for the sole purpose of calculating the fluidlevel in the wellbore. In other forms of the invention, the fluid levelin the wellbore, calculated in accordance with the invention, may beutilized for other purposes, in accordance with the invention, such asfor controlling the centrifugal pump, or for controlling the fluid levelin the wellbore. In some forms of the invention, the zero-flow inputspeed of the centrifugal pump at which the output flow from thecentrifugal pump becomes substantially zero is determined without usingoutput flow from the centrifugal pump as part of the determination. Inother forms of the invention, a flow meter located on the surface may beused for determining the zero-flow input speed of the centrifugal pump.

The zero-flow input speed may be determined by monitoring input torqueto the centrifugal pump as the input speed is reduced, and detecting thezero-flow input speed as an input speed at which an incrementalreduction and input speed results in a distinct drop or other change inthe input torque.

Specifically, in some forms of the invention, zero-flow speed isdetected by monitoring the differential of input torque as a function ofinput speed, while the input speed is incrementally reduced, with thezero-flow speed being determined to be substantially the input speed atwhich the differential of input torque as a function of input speedachieves a maximum value. Alternatively, the zero-flow speed may bedetermined to be the speed at which the differential of input torque asa function of input speed falls below a selected minimum value that isless than the maximum monitored value of the differential of inputtorque as a function of input speed. The selected minimum value of thedifferential of input torque as a function of input speed may be apositive, negative, or equal to zero, in various forms of the invention.

The zero-flow input speed may alternatively be determined by monitoringother appropriate combinations of various motor and/or pump parameters,as the input speed is reduced, and detecting the zero-flow input speedas a value of the monitored parameters at which an incremental reductionin input speed results in a distinct drop or other change in themonitored combination of parameters. For example, the zero-flow inputspeed may be determined by monitoring the differential of motor currentas a function of input speed as the input speed is reduced, anddetecting the zero-flow input speed as an input speed at which anincremental reduction in input speed results in a distinct change in themotor current. In similar fashion, the zero-flow input speed may bedetermined by monitoring the differential of motor current as a functionof motor frequency as the motor electrical frequency is reduced, andcalculating the zero-flow input speed from the frequency at which anincremental reduction in frequency results in a distinct change in themotor current.

In determining the zero-flow input speed of the motor, in accordancewith the invention, as described above, it will be understood that thepump input speed will generally equal the motor speed, and that the pumpinput torque will equal the motor torque, where the motor is directlycoupled to the pump. Those having skill in the art will readilyrecognize, however, that the invention may also be practiced in systemshaving the pump indirectly coupled to the motor, through interveninggearboxes or other drive elements, by incorporating appropriateconversion factors reflecting the intervening drive elements into thecalculations disclosed herein in the manner known in the art.

The invention may further include using an affinity law for calculatinga zero-flow pump differential pressure at the zero-flow input speed, andusing the zero-flow pump differential pressure for calculating the fluidlevel in the wellbore. The zero-flow pump differential pressure thuscalculated is an approximation of the pressure being generated in thecentrifugal pump, between the intake and outlet of the pump. Inpracticing the invention, pressure may be expressed as an absolutepressure, or alternatively in linear units of lift height, as iscustomary in some industries, so long as consistency and harmonizationof units is maintained.

A desired or nominal, rated-operating input speed of the centrifugalpump may be selected and utilized for determining a rated-outputpressure of the centrifugal pump when producing output flow at therated-operating input speed and rated-output pressure. The zero-flowpump differential pressure at the zero-flow input speed may becalculated, using affinity laws, by multiplying the rated-operatingoutput pressure by an appropriate power (such as the square for example)of the quotient of the zero-flow input speed divided by therated-operating input speed of the centrifugal pump. Alternatively,look-up tables may be utilized.

In some forms of the invention, the centrifugal pump includes an output(i.e. discharge) thereof connected to an output tube extending upwardfrom the pump through the wellbore to the surface. The wellbore maydefine a depth of the pump inlet, and fluid within the tube may define aspecific weight and an internal pressure of the fluid within the tube atthe surface of the wellbore or the like. The zero-flow dischargepressure of the pump (i.e. pressure at the pump outlet) may becalculated by subtracting the length of the pump (i.e. the verticaldistance between the inlet and the outlet of the pump) from the depth ofthe pump inlet, multiplying the resulting difference by the fluidspecific weight in the tube, and adding to the product formed therebythe internal pressure of the fluid within the tube at the surface.

In certain embodiments of the invention, the length of the pump may beignored without significantly affecting the results of the abovecalculation. For example, even though a centrifugal pump of the typeused in an oil or gas well may have a length of thirty feet, or so, thelength of the pump is diminimus in comparison to the depth of the pumpinlet which is often as much as 5000 feet below the surface of theground.

The invention may further include calculating an intake pressure of thecentrifugal pump by subtracting the zero-flow pump differential pressurefrom the zero-flow discharge pressure of the pump. Where the wellboredefines a casing pressure at the surface, and fluid in the wellboredefines a specific weight of the fluid in the wellbore, the inventionmay further include calculating the fluid level in the wellbore bysubtracting the casing pressure from the intake pressure of thecentrifugal pump, and dividing the resulting difference by the specificweight of the fluid in the wellbore.

In some forms of the invention, a flow rate may be determined for acentrifugal pump operating at a selected pump speed while disposed in awellbore for transferring fluid in the wellbore, without directlymeasuring the flow rate, by calculating the flow rate as a function ofthe selected speed and a fluid level in the wellbore. The calculatedflow rate may be used for controlling the centrifugal pump. For example,in some forms of the invention, the calculated flow may be used forcontrolling speed of the centrifugal pump to a selected minimum ratedspeed so that the pump speed is always greater than or equal to theselected minimum speed of the pump, to thereby ensure that pump speed isalways held at a safe distance above the zero-flow speed.

Calculation of a flow rate from a centrifugal pump, as a function of theselected speed and a fluid level in a wellbore, may further include apreliminary step of determining the fluid level in the wellbore,according the methods of the present invention. This aspect of theinvention provides particular advantage in applications whereelectrically driven submersible pumps exhibit only very small changes inpump power or torque as the flow changes through the pump, or in systemshaving pumps with pump curves that are not strictly monotonic, with amaximum occurring near the pump Best Efficiency Point (BEP). In suchpumps, determination of pump flow, using only input speed and torque inthe manner described herein with regard to other aspects of theinvention, can be difficult. By determining the flow rate of thecentrifugal pump as a function of a selected pump speed and the fluidlevel in the wellbore, the flow rate may be determined, according to theinvention, without the need for having a flow sensor for directlymeasuring the flow, thereby reducing complexity and improvingreliability through practice of the invention.

In some forms of the invention, the flow rate from a centrifugal pumpmay be determined, utilizing a fluid level in the wellbore measured byany appropriate method known in the art, such as physical measurement,or through acoustic reflection. According to some aspects of theinvention, the flow rate may be determined as a function of a fluidlevel which is determined, in accordance with the invention, bydetermining a zero-flow input speed of the centrifugal pump at whichoutput flow from the centrifugal pump is substantially zero, and usingthe zero flow input speed to calculate the fluid level in the wellbore.

The invention may further include controlling the centrifugal pump tomaintain a minimum flow rate of the pump at a value greater than zero.

Where a centrifugal pump is connected to an outlet tubing system, theinvention may include calculating a flow from the centrifugal pump byperforming steps including: determining a combined characteristicequation for the centrifugal pump operating in the system as a functionof the fluid level in the wellbore; solving the combined characteristicequation for a zero-flow pump speed and; and, solving for the pump flowas a function of a selected pump speed which is greater than a zero-flowspeed of the pump. Determining the combined characteristic equation maybe accomplished, in some forms of the invention, by fitting a curve or atable to the system head loss equations, according to aMoody/Darcy-Weisbach analysis, at pump flows within the operating rangeof the system. The combined characteristic equation may then be solvedfor a zero-flow pump speed. Once the zero-flow pump speed is known, thecombined characteristic equation for pump flow may be utilized to solvefor pump flow at any pump speed greater than the zero-flow speed.

The invention also provides an improved apparatus and method fordetecting and dealing with a pump-off or gas-lock condition in awellbore. The invention also provides an apparatus and method forperiodic determination of a minimum fluid depth and/or maximum pumpspeed at which the well may be operated continuously withoutencountering a pump-off or gas-lock condition. The invention furtherprovides a method and apparatus for controlling the well in a mannerallowing pumping at a maximum sustainable rate, while precluding thepossibility of encountering a pump-off or gas-lock condition, duringeither normal continuous operation of the well or recovery from apump-off or gas-lock condition. The invention also provides an apparatusand method for automatically periodically adjusting the pump speed, ifnecessary, to maintain a maximum pumping rate from the well.

The invention may be utilized for detecting the onset of a pump-offand/or gas-lock condition by monitoring an appropriate parameter, suchas pump input torque or current to an electric motor driving the pump,or a derivative or other computed value as a function of the monitoredparameter. In one form of the invention, the onset of a pump-off and/orgas-lock condition is detected when motor current or torque drops belowan under load value. Unlike prior systems and methods, however, whichrequired that the pump be shut down following detection of a pump-offand/or gas-lock condition, the invention allows the pump to becontrolled in such a manner that it can continue to operate at a reducedspeed, during the period of time that the well is recovering from thepump-off and/or gas-lock condition.

In some forms of a method and apparatus, according to the invention, aperiodic test is performed to determine if the pump can be safely run ata higher speed, without risk of instigating a pump-off and/or gas-lockcondition. In accordance with this aspect of the invention, the pumpspeed is periodically increased, over a predetermined time period, byramping up, or otherwise increasing the pump speed in a controlledmanner. As the pump speed is increased, a parameter such as pump torque,or input current to the motor, is monitored, in addition to the pumpspeed. The onset of a pump-off and/or gas-lock condition may bedetermined by monitoring the differential of the selected parameter(i.e. torque or current) as a function of motor speed, as the pump speedis increased, and detecting the speed at which pump-off and/or gas-lockis triggered, to be the pump speed at which an incremental reduction inpump speed results in a distinct change in the monitored parameter. Thepump speed may then be reduced below the speed at which the onset ofpump-off and/or gas-lock was determined to occur. The invention mayinclude reducing the speed by a selected offset value below thedetermined onset speed. In some forms of the invention, the offset maybe adjustable.

If no onset of pump-off and/or gas-lock is detected during the timeperiod in which the pump speed is being increased, the pump speed may bereset to the maximum value achieved during the monitoring period, forcontinuous safe operation at that speed. After a short period ofoperation at the increased speed, the periodic test for onset ofpump-off and/or gas-lock may be repeated, to determine whether the pumpmay be operated at a yet higher speed.

The periodic test for determining a maximum safe pumping speed may beutilized during the period of time after an unanticipated onset ofpump-off and/or gas-lock, to determine a safe reduced speed at which thepump may be operated while the well is recovering from the pump-offand/or gas-lock condition. Following recovery of the well, the periodictest, according to the invention, may be utilized in conjunction withcontrol aspects of the invention, for determining a new maximumcontinuous operating speed for the pump, and automatically controllingthe pump at the new maximum safe operating speed for the well. Byperforming the periodic test and controlling the pump accordingly, on anongoing basis, the pump will always run at the proper maximum pumpingspeed, automatically, without interruption in production of the well.

In some forms of the invention, the pump may be controlled to slow downto a preset reduced speed, upon detection of the onset of a pump-offand/or gas-lock condition.

In other forms of the invention, the motor may be controlled to drivethe pump at an appropriate reduced speed, determined in accordance withthe invention, to operate the pump “right on-the-edge” of triggering apump-off and/or gas-lock condition.

The invention may take various forms, including a method, an apparatus,or a computer-readable medium, having computer executable instructions,or performing the steps of a method, or controlling an apparatusaccording to the invention.

Uses of the self-sensing pump control system also include, but are notlimited to HVAC systems, multi-pump control, irrigation systems,wastewater systems, and municipal water systems.

Other aspects, objectives and advantages of the invention will becomemore apparent from the following detailed description when taken inconjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings incorporated in and forming a part of thespecification illustrate several aspects of the present invention and,together with the description, serve to explain the principles of theinvention. In the drawings:

FIG. 1 is a simplified representation of a well including a centrifugalpump, the operation of which is controlled by a pump control system inaccordance with the present invention;

FIG. 2 is a block diagram of the centrifugal pump control system of FIG.1;

FIG. 3 is a functional block diagram of a pump control system for thecentrifugal pump of FIG. 1 when using estimated flow;

FIG. 4 is a functional block diagram of a pump control system for thecentrifugal pump of FIG. 1 when using measured flow;

FIG. 5 is a block diagram of an algorithm for a pump model of thecentrifugal pump control system of FIG. 3;

FIG. 6 is a block diagram of an algorithm for a pump model of thecentrifugal pump control system of FIG. 4;

FIG. 7 is a block diagram of an algorithm for a system model of thecentrifugal pump control system of FIGS. 3 and 4;

FIG. 8 is a diagram of an algorithm for a fluid level feedforwardcontroller of the centrifugal pump control system of FIGS. 3 and 4;

FIG. 9 is a block diagram of an algorithm for a fluid level feedbackcontroller of the centrifugal pump control system of FIGS. 3 and 4;

FIG. 10 is a simplified block diagram of an algorithm for a vectorcontroller of the centrifugal pump control system of FIGS. 3 and 4;

FIGS. 11 through 13 are a set of pump specification curves for acentrifugal pump, illustrating pump power, pump head, pump efficiencyand pump suction pressure required wherein each is a function of pumpflow rate at rated speed;

FIG. 14 is a diagram of a typical installation of a centrifugal pump,illustrating the relationship between the pumping system parameters;

FIG. 15 is a block diagram of the controller of the pump control systemof FIGS. 3 and 4;

FIG. 16 is a set of two curves comparing the efficiency of a pumpingsystem using duty cycle control to the efficiency of a pumping systemusing continuous rotary speed;

FIG. 17 is a graphical illustration of pump characteristic curves,illustrating operation at various speeds for a centrifugal pump of atype which may be used in practicing the invention, having superimposedthereupon a representative system characteristic curve for a systemhaving both static and dynamic head.

FIG. 18 is a block diagram of an exemplary embodiment of a method,according to the invention, for determining a fluid level in a wellbore.

FIG. 19 is a graphical illustration showing details of an exemplaryembodiment for performing a step of determining zero-flow input speed,as shown in Block 406 of FIG. 18.

FIG. 20 is a block diagram of an exemplary embodiment of a method,according to the invention, for determining a pump flow without use ofinput torque of a motor driving a centrifugal pump.

FIG. 21 is a simplified graphical illustration of the pump and systemcurves of FIG. 17, illustrating components of a combined characteristiccurve during operation at a rated speed of the centrifugal pump.

FIG. 22 is a graphical illustration showing operation of an apparatus ormethod, according to the invention, for determining the onset of apump-off and/or gas-lock condition in a system according to theinvention, and for controlling a pump of the system to allow forcontinued operation at reduced speed during recovery of the well fromthe pump-off and/or gas-lock condition.

FIG. 23 is a graphical illustration showing operation of an apparatus ormethod, according to the invention, for automatically determining, on aperiodic basis, a maximum pumping speed for continued operation of asystem according to the invention, in a manner precluding instigation ofa pump-off and/or gas-lock condition.

Variables used throughout the drawings generally have the followingform: A variable with a single subscript indicates that the referenceis: to an actual element of the system, as in Tm for the torque of themotor; a value that is known in the system and is stable, as in Xp forthe depth of the pump; for a rated value, such as Hr for rateddifferential pressure of the pump. A variable with a second subscript of‘m’, as in Vmm for measured motor voltage, indicates that the variableis measured on a real-time basis. Similarly, a second subscript of ‘e’indicates an estimated or calculated value like Tme for estimated motortorque; a second subscript of ‘c’ indicates a command like Vmc for motorvoltage command; and a second subscript of ‘f’ indicates a feedforwardcommand like Umf for motor speed feedforward command. Variables having asecond or third subscript of “z,” indicate that the variable applies ata zero-flow condition of the pump, as in Hpz for head pressure developedby the pump at a zero flow condition, corresponding to a zero-flow speedUpz, whereat the pump speed Up has been reduced to a point where flowfrom the pump ceases. Variables in bold type, as in Vs for statorvoltage, are vector values having both magnitude and direction.

The meanings of other variables without subscripts, or havingspecialized single or multiple subscripts relating to certain specificaspects of the invention will be further defined or apparent from thecontext in which they are used herein.

While the invention will be described in connection with certainpreferred embodiments, there is no intent to limit it to thoseembodiments. On the contrary, the intent is to cover all alternatives,modifications and equivalents as included within the spirit and scope ofthe invention as defined by the appended claims.

DETAILED DESCRIPTION OF THE INVENTION

Referring to FIG. 1, the present invention is described with referenceto an oil well 30 wherein oil is to be pumped from an undergroundformation 22. The well includes an outer casing 39 and an inner tube 38that extend from ground level to as much as 1000 feet or more belowground level. The casing 39 has perforations 26 to allow the fluid inthe underground formation to enter the wellbore. It is to be understoodthat water and gas can be combined with oil and the pump can be used forother liquids. The control apparatus can also be used for pumping wateronly. The bottom of the tube generally terminates below the undergroundformations.

A centrifugal pump of the type known as an electric submersible pump(ESP) 32 is mounted at the lower end of the tube 38 and includes one ormore centrifugal pump members 34 mounted inside a pump housing. The pumpmembers are coupled to and driven by a drive motor 36 which is mountedat the lower end of the pump housing. The tube 38 has a liquid outlet 41and the casing 39 has a gas outlet 42 at the upper end above groundlevel 31. An optional check valve 28 may be located on the dischargeside of the pump 32 to reduce back flow of fluid when the pump is off.These elements are shown schematically in FIG. 1.

The operation of the pump 32 is controlled by a pump control system andmethod including a parameter estimator in accordance with the presentinvention. For purposes of illustration, the pump control system 20 isdescribed with reference to an application in a pump system thatincludes a conventional electric submersible pump. The electricsubmersible pump includes an electric drive system 37 connected to motor36 by motor cables 35. A transformer (not shown) is sometimes used atthe output of the drive to increase voltage supplied to the motor. Themotor rotates the pump elements that are disposed near the bottom 33 ofthe well. The drive 37 receives commands from controller 50 to controlits speed. The controller 50 is located above ground and contains allthe sensors and sensor interface circuitry and cabling necessary tomonitor the performance of the pump system.

The motor 36 can be a three-phase AC induction motor designed to beoperated from line voltages in the range of 230 VAC to several thousandVAC and developing 5 to 500 horsepower or higher, depending upon thecapacity and depth of the pump.

Pump Control System

Referring to FIG. 2, there is shown a simplified representation of thepump control system 20 for the pump 32. The pump control system 20controls the operation of the pump 32. In one embodiment, the casingfluid level is estimated using pump flow rate and head pressureestimates which, in turn, can be derived from values of motor speed andtorque estimates. The pump flow rate and head pressure estimates arecombined with system model parameters to produce a casing fluid levelestimate. In one preferred embodiment, a pump model and system model areused to produce estimated values of pump flow rate and casing fluidlevel for use by a pump controller in producing drive control signalsfor the pump 32.

Alternatively, the measured discharge flow rate of the pump 32 can beobtained using measurements from the surface flow sensor 59 and combinedwith the estimates produced by the pump and system models to produce thecasing fluid level estimate. This is particularly useful when theconfiguration of the pump makes it difficult to accurately calculatepump flow rate from the mechanical inputs to the pump.

While in a primary function the estimated parameters are used forcontrol, the parameters also can be used for other purposes. Forexample, the estimated parameters can be compared with those measured bysensors or transducers for providing diagnostics alarms. The estimatedparameters may also be displayed to setup, maintenance or operatingpersonnel as an aid to adjusting or troubleshooting the system.

In one embodiment, values of flow and pressure parameters are derivedusing measured or calculated values of instantaneous motor currents andvoltages, together with pump and system parameters, without requiringdown hole sensors, fluid level meters, flow sensors, etc. The flow andpressure parameters can be used to control the operation of the pump 32to optimize the operation of the system. In addition, pump performancespecifications and system identification routines are used to establishparameters used in calculating performance parameters that are used inreal time closed-loop control of the operation of the pump.

The pump control system 20 includes transducers, such as above groundcurrent and voltage sensors, to sense dynamic variables associated withmotor load and velocity. The pump control system further includes acontroller 50, a block diagram of which is shown in FIG. 2. Above groundcurrent sensors 51 of interface devices 140 are coupled to a sufficientnumber of the motor cables 35, two in the case of a three phase ACmotor. Above ground voltage sensors 52 are connected across the cablesleading to the motor winding inputs. The current and voltage signalsproduced by the sensors 51 and 52 are supplied to a processing unit 54of the controller 50 through suitable input/output devices 53. Thecontroller 50 further includes a storage unit 55 including storagedevices which store programs and data files used in calculatingoperating parameters and producing control signals for controlling theoperation of the pump system. This self-sensing control arrangementprovides nearly instantaneous estimates of motor velocity and torque,which can be used for both monitoring and real-time, closed-loop controlof the pump. For example, in one embodiment, instantaneous estimates ofmotor velocity and torque used for real-time, closed-loop control areprovided at the rate of about 1000 times per second.

Motor currents and voltages are sensed or calculated to determine theinstantaneous speed and torque produced by the electric motor operatingthe pump. As the centrifugal pump 32 is rotated, the motor 36 is loaded.By monitoring the motor currents and voltages above ground, thecalculated torque and speed produced by the motor 36, which may be belowground, are used to calculate estimates of fluid flow and head pressureproduced by the pump 32.

More specifically, interface devices 140 include the devices forinterfacing the controller 50 with the outside world. None of thesedevices are located below ground. Sensors in blocks 51 and 52 caninclude hardware circuits which convert and calibrate the current andvoltage signals into current and flux signals. After scaling andtranslation, the outputs of the voltage and current sensors can bedigitized by analog to digital converters in block 53. The processingunit 54 combines the scaled signals with cable and motor equivalentcircuit parameters stored in the storage unit 55 to produce a precisecalculation of motor torque and motor velocity. Block 59 contains anoptional surface flow meter which can be used to measure the pump flowrate. Block 59 may also contain signal conditioning circuits to filterand scale the output of the flow sensor before the signal is digitizedby analog to digital converters in Block 53.

Pump Control

Referring to FIG. 3, which is a functional block diagram of the pumpcontrol system 20 for a pump 32 where the pump flow rate to pump powerrelationship allows pump flow rate to be calculated, the pump 32 isdriven by a drive 37 and motor 36 to transfer fluid within a system 150.The operation of the motor 36 is controlled by the drive 37 andcontroller 50 which includes a pump model 60, system model 80, fluidlevel feedforward controller 90, fluid level feedback controller 100,motor vector controller 130 and interface devices 140.

More specifically, Block 140, which is located above ground, can includehardware circuits which convert and calibrate the motor current signalsIm (consisting of individual phase current measurements Ium and Ivm inthe case of a three phase motor) and voltage signals Vm (consisting ofindividual phase voltage measurements Vum, Vvm, and Vwm in the case of athree phase motor) into motor current and flux signals. After scalingand translation, the outputs of the voltage and current sensors can bedigitized by analog to digital converters into measured voltage signalsVmm and measured current signals 1 mm. The motor vector controller 130combines the scaled signals with cable and motor equivalent circuitparameters to produce a precise calculation of motor electrical torqueTme and velocity Ume. Automatic identification routines can be used toestablish the cable and motor equivalent circuit parameters.

The pump model 60 calculates the values of parameters, such as pump flowrate Qpe, pump head pressure Hpe, pump head pressure at rated speed Hre,minimum required suction head pressure Hse, pump efficiency Epe, andpump safe power limit Ple relating to operation of the pump 32 frominputs corresponding to motor torque Tme and motor speed Ume without theneed for external flow or pressure sensors. This embodiment is possiblefor pumps where the relationship of pump flow rate to pump power atrated speed, as shown in FIG. 13, is such that each value of power hasonly one unique value of pump flow rate associated with it throughoutthe range of pump flows to be used. Further, the system model 80 derivesestimated values of the pump suction pressure Pse, flow head loss Hfe,pump discharge pressure Pde and the casing fluid level Xce from inputscorresponding to discharge flow rate value Qpe and the head pressurevalue Hpe of the pump. The fluid level feedforward controller 90 usesthe pump head pressure at rated speed value Hre, flow head loss valueHfe and commanded fluid level Xcc to calculate a motor speed feedforwardcommand Umf. The fluid level feedback controller 100 compares thecommanded fluid level Xcc with static and dynamic conditions of thefluid level value Xce to calculate a motor velocity feedback commandUfc. Motor velocity feedback command Ufc and feedforward command Umf areadded in summing Block 79 to yield the motor velocity command Umc.

Motor vector controller 130 uses the motor speed command Umc to generatemotor current commands Imc and voltage commands Vmc. Interface devicesin Block 140, which can be digital to analog converters, convert thecurrent commands Imc and voltage commands Vmc into signals which can beunderstood by the drive 37. These signals are shown as Ic for motorcurrent commands and Vc for motor winding voltage commands. Ininstallations with long cables and/or step up transformers, the signalsIc and Vc would be adjusted to compensate for the voltage and currentchanges in these components.

Referring to FIG. 4, which is a functional block diagram of the pumpcontrol system 20 for a pump 32 where the pump flow rate is measuredabove ground, the pump 32 is driven by a drive 37 and motor 36 totransfer fluid within a system 150. The operation of the motor 36 iscontrolled by the drive 37 and controller 50 which includes a pump model260, system model 80, fluid level feedforward controller 90, fluid levelfeedback controller 100, motor vector controller 130 and interfacedevices 140.

More specifically, Block 140, which is located above ground, can includehardware circuits which convert and calibrate the motor current signalsIm (consisting of individual phase current measurements Ium and Ivm inthe case of a three phase motor) and voltage signals Vm (consisting ofindividual phase voltage measurements Vum, Vvm, and Vwm in the case of athree phase motor) into motor current and flux signals. After scalingand translation, the outputs of the voltage and current sensors can bedigitized by analog to digital converters into measured voltage signalsVmm and measured current signals 1 mm. The motor vector controller 130combines the scaled signals with cable and motor equivalent circuitparameters to produce a precise calculation of motor electrical torqueTme and velocity Ume. Automatic identification routines can be used toestablish the cable and motor equivalent circuit parameters.

In this embodiment, Block 140 also may contain hardware circuits whichconvert above ground flow rate into an electrical signal that can bedigitized by analog to digital converters into the measured flow signalQpm for use by the pump model 260 and the system model 80.

The pump model 260 calculates the values of parameters pump headpressure Hpe, pump head pressure at rated speed Hre, minimum requiredsuction head pressure Hse, pump efficiency Epe, and pump safe powerlimit Ple relating to operation of the pump 32 from inputs correspondingto flow Qpm as measured by a flow sensor and motor speed Ume without theneed for other external sensors. This embodiment is used for pumps wherethe relationship of pump flow rate to pump power at rated speed is suchthat there is not a unique pump flow rate for each value of pump power.Further, the system model 80 derives estimated values of the pumpsuction pressure Pse, flow head loss Hfe, pump discharge pressure Pdeand the casing fluid level Xce from inputs corresponding to dischargeflow rate value Qpm and the head pressure value Hpe of the pump. Thefluid level feedforward controller 90 uses the motor speed value Ume,flow head loss value Hfe and commanded fluid level Xcc to calculate amotor speed feedforward command Umf. The fluid level feedback controller100 compares the commanded fluid level Xcc with static and dynamicconditions of the fluid level value Xce to calculate a motor velocityfeedback command Ufc. Motor velocity feedback command Ufc andfeedforward command Umf are added in summing Block 79 to yield the motorvelocity command Umc.

Motor vector controller 130 uses the motor speed command Umc to generatemotor current commands Imc and voltage commands Vmc. Interface devicesin Block 140, which can be digital to analog converters, convert thecurrent commands Imc and voltage commands Vmc into signals which can beunderstood by the drive 37. These signals are shown as Ic for motorcurrent commands and Vc for motor winding voltage commands. Ininstallations with long cables and/or step up transformers, the signalsIc and Vc would be adjusted to compensate for the voltage and currentchanges in these components.

The controller 50 provides prescribed operating conditions for the pumpand/or system. To this end, either pump model 60 or pump model 260 alsocan calculate the efficiency Epe of the pump for use by the controller50 in adjusting operating parameters of the pump 32 to determine thefluid level Xc needed to maximize production of gas or produced fluidand/or the fluid level Xc needed to maximize production with a minimumpower consumption.

The controller 50 (FIG. 3 and FIG. 4) uses the parameter estimates tooperate the pump so as to minimize energy consumption, optimize gasflow, and maintain the fluid level to accomplish the objectives. Otherinputs supplied to the controller 50 include the commanded casing fluidlevel Xcc and values representing casing pressure Pc and tubing pressurePt (FIG. 8). Values representing casing pressure Pc and tubing pressurePt may each be preset to approximate values as part of the system setupor, as is preferable in situations where these values are likely to varyduring operation of the system, the controller 50 can use valuesmeasured by sensors mounted above ground and connected to the controller50 through appropriate signal conditioning and interface circuitry.

The controller 50 (FIG. 3 and FIG. 4) optimizes use of electrical poweras the flow delivery requirements change and can determine fluid levelwithout using down hole sensors and, in one preferred embodiment,without using surface flow sensors. As will be shown, the controloperations provided by the controller 50 include the use of the pumpmodel 60 (FIG. 3) or pump model 260 (FIG. 4) and system model 80 (FIG. 3or FIG. 4) to relate mechanical pump input to output flow rate and headpressure. In one embodiment (FIG. 3), this is achieved by deriving anestimate of pump flow rate from above ground measurements of motorcurrent and voltage. In another embodiment (FIG. 4), the pump flow rateis measured using a surface flow sensor. From the flow value thusobtained, the pump head pressure, efficiency and other pump operatingparameters are determined using pump curve data. The results are used tocontrol the pump 32 to protect it from damage and to provide closed-loopcontrol of the pump 32 in order to optimize the operation of the pumpingsystem. Protecting the pump 32 includes detecting blockage, cavitation,and stuck pump.

Moreover, the operation of the pump 32 can be controlled to enable it tooperate periodically, such that the pump can operate efficiently at adecreased average pump flow rate. This obviates the need to replace theelectric submersible pump with another pump, such as a rod beam pump,when fluid level or inflow within the well decreases over time.

Further, in accordance with the invention, the pump can be cycledbetween its most efficient operating speed and zero speed at a variableduty cycle to regulate average pump flow rate. Referring to FIG. 1, incases where electric submersible pumps are being operated at a low dutycycle, such as on for twenty-five percent of the time and off forseventy-five percent of the time, a check valve 28 may be used down holeto prevent back flow of previously pumped fluid during the portion ofeach cycle that the pump is off. The check valve 28 can be designed toallow a small amount of leakage. This allows the fluid to slowly drainout of the tube 38 to allow maintenance operations.

Pump Model

Reference is now made to FIG. 5, which is a block diagram of analgorithm for the pump model 60 of the pump 32 as used in the embodimentshown in FIG. 3 where it is possible to calculate an estimate of pumpflow rate. The pump model 60 is used to calculate estimates ofparameters including head pressure Hpe, fluid flow Qpe, minimum requiredsuction head pressure Hse, pump mechanical input power limit Ple, andpump efficiency Epe. In one preferred embodiment, the calculations arecarried out by the processing unit 54 (FIG. 2) under the control ofsoftware routines stored in the storage devices 55 (FIG. 2). Briefly,values of motor torque Tme and motor speed Ume are used to calculate themechanical power input to the pump Ppe which is used with the motorspeed value Ume to calculate what the flow Qre would be at rated pumpspeed Ur. This value of Qre is used with formulas derived from publishedpump data and pump affinity laws to solve for the pump head at ratedspeed Hre, pump efficiency Epe, and minimum required suction headpressure required Hse. Using the value of motor speed Ume, the values ofpump head at rated speed Hre and pump flow rate at rated speed Qre arescaled using pump affinity laws to estimated values of pump head Hpe andpump flow rate Qpe, respectively.

With reference to the algorithm illustrated in FIG. 5, the value forpump mechanical input power Ppe is obtained by multiplying the value formotor torque Tme by the value of motor speed Ume in Block 61. In Block62, the mechanical input power applied to the pump, Ppe is multiplied bya scaling factor calculated as the cube of the ratio of the rated speedof the pump Ur to the current speed Ume to yield a value representingthe power Pre which the pump would require at rated pump speed Ur. Thisscaling factor is derived from affinity laws for centrifugal pumps.

Block 63 derives a value of the pump flow rate Qre at the rated speedwith the current conditions. This value of pump flow rate Qre at ratedspeed is calculated as a function of power Pre at rated speed Ur. Pumpmanufacturers often provide pump curves such as the one shown in FIG.13, which relates pump mechanical input power Pp to flow Qre at ratedspeed. Alternatively, such a curve can be generated from values of pumphead as a function of flow at rated speed, pump efficiency as a functionof flow at rated speed, and the fluid density. The function of Block 63(FIG. 5) is derived from the data contained in the graph. One of twomethods is used to derive the function of Block 63 from the data in thisgraph. The first method is to select data points and use curve fittingtechniques, which are known, to generate an equation describing power asa function of flow. Solving the equation so flow is given as a functionof power will provide one method of performing the calculation in Block63. One simple method is to fit the data to a second order equation. Inthe case of a second order equation, the solution for flow is in theform of a quadratic equation which yields two solutions of flow for eachvalue of power. In this case, Block 63 must contain a means of selectingflow value Qre from the two solutions. This is usually easy as one ofthe values will be much less likely than the other, if not impossible asin a negative flow solution. The second method is to select severalpoints on the graph to produce a look-up table of flow versus power.With such a look-up table, it is relatively easy to use linearinterpolation to determine values of Qre between data points.

In Block 64, the value for flow at rated speed, Qre, is scaled by theratio of the current speed Ume to the rated speed Ur to yield the pumpflow rate value Qpe. This scaling factor is derived from affinity lawsfor centrifugal pumps.

Block 65 calculates a value of head pressure at rated speed Hre as afunction of flow at rated speed Qre. Pump manufacturers provide pumpcurves such as the one shown in FIG. 11, which relates pump headpressure to flow at rated speed. The function of Block 65 is uses thedata contained in the graph. One of two methods is used to derive thefunction of Block 65 from the data in this graph. The first method is toselect data points and use curve fitting techniques, which are known, togenerate an equation describing pump head pressure as a function offlow. The second method is to select several points on the graph toproduce a look-up table of pump head pressure versus flow. With such alook-up table, it is relatively easy to use linear interpolation todetermine values of Hre between data points. In Block 66, the value forpump head pressure at rated speed, Hre, is scaled by the square of ratioof the current speed Ume to the rated speed Ur to yield the pump headpressure value Hpe. This scaling factor is derived from affinity lawsfor centrifugal pumps.

The efficiency of the pump is calculated in Block 67 to yield the valueEpe. Pump efficiency is the ratio of fluid power output divided bymechanical power input. Pump manufacturers provide pump curves such asthe one shown in FIG. 12, which relates pump efficiency to pump flowrate at rated speed. The function of Block 67 is derived from the datacontained in the graph. One of two methods is used to derive thefunction of Block 67 from the data in this graph. The first method is toselect data points and use curve fitting techniques, which are known, togenerate an equation describing pump efficiency as a function of flow.The second method is to select several points on the graph to produce alook-up table of pump efficiency versus flow. With such a look-up table,it is relatively easy to use linear interpolation to determine values ofEpe between data points.

An estimate of the suction head pressure required at the input of thepump, Hse, is calculated in Block 68. Pump manufacturers provide pumpcurves such as the one shown in FIG. 11, which relates the pump'sminimum required suction head pressure Hs to pump flow rate at ratedspeed. The function of Block 68 is derived from the data contained inthe graph. One of two methods is used to derive the function of Block 68from the data in this graph. The first method is to select data pointsand use curve fitting techniques, which are known, to generate anequation describing pump suction pressure required as a function offlow. The second method is to select several points on the graph toproduce a look-up table of pump suction pressure required versus pumpflow rate. With such a look-up table, it is relatively easy to uselinear interpolation to determine values of Sre between data points.

A mechanical input power limit for the pump is calculated in Block 69.The end of curve power level Pe as shown in FIG. 13 is scaled by thecube of the ratio of the current speed Ume to the rated speed Ur toprovide the mechanical input power limit estimate Ple. This scalingfactor is derived from affinity laws for centrifugal pumps. Themechanical input power limit value can be used to limit the torqueand/or the speed of the pump, and thereby limit power, to levels whichwill not damage the pump.

Reference is now made to FIG. 6, which is a block diagram of analgorithm for the pump model 260 of the pump 32 as used in theembodiment shown in FIG. 4 where it is not possible to calculate anestimate of pump flow rate. The pump model 260 is used to calculateestimates of parameters including head pressure Hpe, minimum requiredsuction head pressure Hse, pump mechanical input power limit Ple, andpump efficiency Epe. In one preferred embodiment, the calculations arecarried out by the processing unit 54 (FIG. 2) under the control ofsoftware routines stored in the storage devices 55 (FIG. 2). Briefly,values of measured fluid flow Qpm and motor speed Ume are used tocalculate what the flow Qre would be at rated pump speed Ur. This valueof flow Qre is used with formulas derived from published pump data andpump affinity laws to solve for the pump head at rated speed Hre, pumpefficiency Epe, and minimum required suction head pressure required Hse.Using the value of motor speed Ume, the values of pump head at ratedspeed Hre and pump flow rate at rated speed Qre are scaled using pumpaffinity laws to estimated values of pump head Hpe and pump flow rateQpe respectively.

With reference to the algorithm illustrated in FIG. 6, in Block 264, thevalue for measured pump flow rate Qpm is scaled by the ratio of therated speed of the pump Ur to the speed of the pump Ume to derive anestimate of the flow of the pump at rated speed Qre. This scaling factoris derived from affinity laws for centrifugal pumps.

Block 265 calculates a value of head pressure at rated speed Hre as afunction of flow Qre at rated speed Ur. Pump manufacturers provide pumpcurves such as the one shown in FIG. 11, which relates pump headpressure to flow at rated speed. The function of Block 265 is derivedfrom the data contained in the graph. One of two methods is used toderive the function of Block 265 from the data in this graph. The firstmethod is to select data points and use curve fitting techniques, whichare known, to generate an equation describing pump head pressure as afunction of flow. The second method is to select several points on thegraph to produce a look-up table of pump head pressure versus flow. Withsuch a look-up table, it is relatively easy to use linear interpolationto determine values of Hre between data points. In Block 266, the valuefor pump head pressure at rated speed, Hre, is scaled by the square ofthe ratio of the current speed Ume to the rated speed Ur to yield thepump head pressure value Hpe. This scaling factor is derived fromaffinity laws for centrifugal pumps.

The efficiency of the pump is calculated in Block 267 to yield the valueEpe. Pump efficiency is the ratio of fluid power output divided bymechanical power input. Pump manufacturers provide pump curves such asthe one shown in FIG. 12, which relates pump efficiency to pump flowrate at rated speed. The function of Block 267 is derived from the datacontained in the graph. One of two methods is used to derive thefunction of Block 267 from the data in this graph. The first method isto select data points and use curve fitting techniques, which are known,to generate an equation describing pump efficiency as a function offlow. The second method is to select several points on the graph toproduce a look-up table of pump efficiency versus flow. With such alook-up table, it is relatively easy to use linear interpolation todetermine values of Epe between data points.

An estimate of the suction head pressure required at the input of thepump, Hse, is calculated in Block 268. Pump manufacturers provide pumpcurves such as the one shown in FIG. 11, which relates the pump'sminimum required suction head pressure Hs to pump flow rate at ratedspeed. The function of Block 268 is derived from the data contained inthe graph. One of two methods is used to derive the function of Block 68from the data in this graph. The first method is to select data pointsand use curve fitting techniques, which are known, to generate anequation describing pump suction pressure required as a function offlow. The second method is to select several points on the graph toproduce a look-up table of pump suction pressure required versus pumpflow rate. With such a look-up table, it is relatively easy to uselinear interpolation to determine values of Sre between data points.

A mechanical input power limit for the pump is calculated in Block 269.The end of curve power level Pe as shown in FIG. 13 is scaled by thecube of the ratio of the current speed Ume to the rated speed Ur toprovide the mechanical input power limit estimate Ple. This scalingfactor is derived from affinity laws for centrifugal pumps. Themechanical input power limit value Ple can be used to limit the torqueand/or the speed of the pump, and thereby limit power, to levels whichwill not damage the pump.

System Model

Reference is now made to FIG. 7, which is a block diagram of analgorithm for the system model 80 of the fluid system 150. The systemmodel 80 is used to calculate estimates of system parameters includingpump suction pressure Pse, pump discharge pressure Pde, head flow lossHfe and casing fluid level Xce. In one preferred embodiment, thecalculations are carried out by the processing unit 54 (FIG. 2) underthe control of software routines stored in the storage devices 55. FIG.14 diagrammatically presents the actual reservoir system parameters usedin FIG. 5 for the pump 32. Ps is the pump suction pressure, Pd is thepump discharge pressure, Hp is the pump head pressure, Hf is the flowhead loss and Qp is the pump flow rate. Lp is the length of the pump, Lt(not shown) is the length of the tubing from the pump outlet to thetubing outlet, Xp is the pump depth and Xc is the fluid level within thecasing 39 (FIG. 1). Pc is the pressure within the casing and Pt is thepressure within the tubing 38. Parameter Dt is the tubing fluid specificweight, parameter Dc is the casing fluid specific weight, and parameterDp (not shown) is the specific weight of the fluid within the pump.

Briefly, with reference to FIG. 7, a value representing pump flow rateQp (such as measured surface flow rate Qpm or estimated pump flow rateQpe), pump head pressure estimate Hpe, and values of tubing pressure Ptand casing pressure Pc are combined with reservoir parameters of pumpdepth Xp and pump length Lp to determine pump suction pressure Pse andcasing fluid level Xce.

More specifically, the processing unit 54 responds to the valuerepresenting pump flow rate Qp. This value representing pump flow rateQp can be either the value of Qpe produced by the pump model 60, asshown in FIG. 3, or the value of Qpm as shown in FIG. 4 from a surfaceflow sensor 59 (FIG. 2). This pump flow rate value is used to calculatea tubing flow head loss estimate Hfe in Block 81. The head loss equationfor Hfe presented in Block 81 can be derived empirically and fit to anappropriate equation or obtained from well known relationships forincompressible flow. One such relationship for flow head loss estimateHfe is obtained from the Darcy-Weisbach equation:

Hfe=f[(L/d)(V ²/2G)]  (1)

where f is the friction factor, L is the length of the tubing, d is theinner diameter of the tubing, V is the average fluid velocity (Q/A,where Q is the fluid flow and A is the area of the tubing), and G is thegravitational constant. For laminar flow conditions (Re <2300), thefriction factor f is equal to 64/Re, where Re is the Reynolds number.For turbulent flow conditions, the friction factor can be obtained usingthe Moody equation and a modified Colebrook equation, which will beknown to one of ordinary skill in the art. For non-circular pipes, thehydraulic radius (diameter) equivalent may be used in place of thediameter in equation (1). Furthermore, in situ calibration may beemployed to extract values for the friction factor fin equation (1) bysystem identification algorithms. Commercial programs that account fordetailed hydraulic losses within the tubing are also available forcalculation of fluid flow loss factors.

It should be noted that although fluid velocity V may change throughoutthe tubing length, the value for fluid velocity can be assumed to beconstant over a given range.

The suction pressure Pse is calculated by adding the head loss Hfecalculated in Block 81 with the pump depth Xp and subtracting the pumphead pressure Hpe in summing Block 82. The output of summing block 82 isscaled by the tubing fluid specific weight Dt in Block 83 and added tothe value representing tubing pressure Pt in summing Block 84 to yieldthe suction pressure Pse.

The pump discharge pressure Pde is calculated by scaling the length ofthe pump Lp by the casing fluid specific weight Dc in Block 87. The pumphead pressure Hpe is then scaled by the pump fluid specific weight Dp inblock 88 to yield the differential pressure across the pump, Ppe. Pumppressure Ppe is then added to the pump suction pressure Pse and thenegative of the output of scaling Block 87 in summing Block 89 tocalculate the pump discharge pressure Pde.

The casing fluid level Xce is calculated by subtracting casing pressurePc from the suction pressure Pse, calculated in summing Block 84, insumming Block 85. The result of summing Block 85 is scaled by thereciprocal of the casing fluid specific weight Dc in Block 86 to yieldthe casing fluid level Xce.

The casing fluid specific weight Dc, pump fluid specific weight Dp, andtubing fluid specific weight Dt may differ due to different amounts andproperties of dissolved gases in the fluid. At reduced pressures,dissolved gases may bubble out of the fluid and affect the fluiddensity. Numerous methods are available for calculation of average fluiddensity as a function of fluid and gas properties which are known in theart.

Wellbore Fluid Level Determination

In addition to the various approaches to determining fluid level Xcdescribed above, the present invention can be utilized for determiningfluid level Xc, in a manner which does not require the optional surfaceflow sensor 59, shown in FIG. 2. As will be described in more detailbelow, the present invention may be used for determining the fluid levelXc in the wellbore 39, by determining a zero-flow input speed Uz to thecentrifugal pump 32 at which output flow from the centrifugal pump 32becomes substantially zero, and using the zero-flow input speed Uz tocalculate the fluid level Xc in the wellbore. Where an apparatus,according to the invention, such as in the exemplary embodiment of thepump control system 20 shown in FIG. 2, has a centrifugal pump 32 drivenby an electric motor 36, determining the zero-flow input speed Uz of thecentrifugal pump 32 can be accomplished in a relatively straightforwardmanner utilizing current and voltage sensors 51, 52, located aboveground level, so that no down-hole sensors need to be provided.

In various embodiments of this aspect of the invention, those havingskill in the art will recognize that the variables utilized in a givenembodiment may be measured or estimated, or some combination of measuredand estimated variables may be used. Accordingly, for ease ofunderstanding, the subscripts “m” and “e” are intentionally omitted fromthe description of aspects of the invention utilizing a variablecorresponding to a zero-flow condition, with the intention that thoseskilled in the art will recognize that either an estimated or a measuredvalue of the variable may be used, dependent upon the specific needs ofa given embodiment. As a result, regardless of whether a particularvariable is measured or estimated, in practicing the invention,variables having a second subscript of “z,” indicate that the variableapplies at a zero-flow condition of the pump, as in Hpz for headpressure developed by the pump at a zero flow condition, correspondingto a zero-flow speed Upz, whereat the pump speed Up has been reduced toa point where flow from the pump is substantially zero.

In practicing this aspect of the invention, the inventors have noted andmade advantageous use of the fact that pump head pressure Hp at zeroflow of the centrifugal pump 32 follows the affinity scaling law Hpz=Hr(Qp=0)(Upz/Ur)̂n, where n is a value substantially in the range of 1.5 to2.5. For example, as illustrated in FIG. 17, for a pump operating atvarious percentages of its operating speed Ur, in a system 300 havingstatic and dynamic head, the affinity scaling law will accuratelypredict that the pump will reach a point of zero flow (Qpz), where theflow differential pressure (Hpz) equals the static head. As illustratedin FIG. 17, the presence of static head in the system causes thezero-flow head pressure Hpz to occur at a percentage of rated speed Urthat is substantially higher than zero. The inventors recognized thatthis phenomenon can be utilized for determining the level of fluid Xc inthe casing 39.

Specifically, the inventors recognized that in systems such as, but notlimited to, submersible pumps in oil, water, or gas production,irrigation systems, waste water systems, or various types of municipalwater systems, once the zero-flow differential pressure Hpz across thecentrifugal pump 32 is known, remaining variables necessary to calculatethe fluid level Xc in the casing 39 are largely a function of geometry,fluid density, or other properties which are either known or relativelyeasily determinable from information available above the surface of theground, or the top of a wellbore, well casing, tank, reservoir, etc., inwhich the centrifugal pump is operating.

With reference to the fluid level system 150 shown in FIG. 14, anexemplary embodiment of a method 400, according to the invention, fordetermining a fluid level Xc in the wellbore 39 is illustrated by theblock diagram shown in FIG. 18. For purposes of clarity of explanation,because values of variables such as pump torque Tp, pump speed Up, pumphead Hp, pump flow Qp, and other variables, may alternatively bemeasured or estimated, in various embodiments of the invention, thesubscripts “m” and “e” will not be used in describing the exemplaryembodiment of the method 400. In similar fashion, although those havingskill in the art will recognize that the values of various variables andparameters referenced in the exemplary embodiment of the method 400 canbe used as feedback or control signals, the subscripts “f” and “c” willnot be used in the description of the method 400.

As shown at Block 402 of FIG. 18, current operating values of inputtorque Tp and input speed Up of the centrifugal pump 32 are determinedby an appropriate manner, such as, for example, by direct measurementwith speed and torque sensors, or through the use of voltage and currentsensors 51, 52 for monitoring an electrical signal being applied to anelectric motor 36 in the embodiment of the pump control system 20 shownin FIG. 2, and calculating input speed Up and torque Tp, by methodsdisclosed elsewhere herein, or by any other appropriate method.

As shown in Block 404, of FIG. 18, once the current operating inputspeed Ur of the centrifugal pump 32 is selected, a zero-flow input speedUz of the centrifugal pump 32 is then determined, without using outputflow Qp from the centrifugal pump 32, by monitoring input torque Tp tothe centrifugal pump 32 as the input speed Up is reduced from thecurrent operating input speed Ur, and detecting the zero-flow inputspeed Uz to have occurred substantially at or near an input speed Uz atwhich a further incremental reduction in input speed U is accompanied bya distinct drop or other marked change in input torque Tp. Whenperforming this step of a method, according to the invention, thezero-flow input speed Uz, may be detected in any appropriate mannerincluding detecting when dT/dU reaches maximum, and/or drops below apre-defined threshold which may be zero or another value appropriate andconvenient for use in a particular embodiment of the invention.

As shown in FIG. 19, for example, as pump speed Up is reduced from thecurrent operating input speed Up, the pump input torque Tp will alsotrend generally downward, in a corresponding manner with pump speed Up,until a speed Uz is reached at which the pump stops producing flow, andat which a further reduction in input speed Up is accompanied by adivergence in the form of a distinct drop or other marked change intorque Tp.

As indicated in the graph of dT/dU in FIG. 19, when the point ofdivergence between the change in speed Up and torque Tp is reached, flowQp becomes somewhat unstable, and may actually become negative, whichsometimes results in the value of dT/dU reaching a detectable maximumvalue 418 of dT/dU, and then trending back toward a minimum or zerovalue of dT/dU, as indicated at 420 in FIG. 19. In various embodimentsof the invention, the zero-flow speed Uz may be determined to be theinput speed Up at the maximum value 418 of dT/dU, a speed Up at whichthe value of dT/dU has dropped back inside of a selected threshold valuesubstantially equal to the point at which dT/dU returns to approximatelyzero, as shown at 420 in FIG. 19, or another appropriate point over arange 422 between the maximum value 418 of dT/dU and the substantiallyzero value of dT/dU, as shown at 420 in FIG. 19.

As shown in Block 406 of FIG. 18, a rated-operating input speed Ur ofthe centrifugal pump 32 is then selected, and a rated differentialpressure Hr(Qr) from the inlet to the outlet of the centrifugal pump 32is determined, with the centrifugal pump 32 producing a rated outputflow (Qr) at the rated-operating input speed Ur and rated-pressureHr(Qr). Those having skill in the art will recognize that the parametersHr(Qr) and output flow Qr of the centrifugal pump 32 at the ratedoperating speed Ur will be defined, as illustrated in FIG. 17, by theintersection 301 of the pump characteristic curve 302 of the centrifugalpump 32 (i.e. the Hr(Q) vs. Q curve for the pump operating at 100% ofthe selected value of rated speed Ur) and the system curve 300 for theoil well 30.

As shown in Block 408 of FIG. 18, once the zero-flow input speed Uz isknown, a zero-flow pump differential pressure Hpz, across the pump 32,at the zero-flow input speed Uz is calculated, using an affinity law, bymultiplying the rated output pressure Hr by a power of the quotient ofthe zero-flow input speed Uz divided by the rated input speed Ur,according to a calculation substantially including the mathematicalexpression Hpz≈Hr (Q=0) (Uz/Ur) ̂n, where n may be any appropriate valuein the range of 1.5 to 2.5, with a value of 2 being used in theexemplary embodiment of the method 400.

As shown in Block 410, of FIG. 18, values of tube-pressure Pt andwellbore pressure Pc are then determined, through use of pressuresensors of any appropriate type known in the art, and the zero-flowdischarge pressure Pdz of the pump 32 is calculated in a mannersubstantially including the expression Pdz≈(Dt*Xp)+Pt, as shown in Block412 of FIG. 18. It will be noted that, in performing this step of theexemplary embodiment of the method 400, for the pump 32 of a length ofabout 30 feet or less positioned at the bottom of a wellbore 39 ofseveral thousand feet in depth, the length of the pump Lp and thespecific weight Dt of the fluid therein is ignored as having a diminimuseffect on calculation of the zero-flow discharge pressure Pdz. In otherembodiments, where it may be desirable to include the effect of pumplength, the value of zero-flow discharge pressure may be calculated in amanner substantially including the expression: Pdz≈Dt*(Xp−Lp)+Pt.

As shown in Block 414, of FIG. 18, the pump intake (suction) headpressure Ps of the centrifugal pump 32 is then calculated in a mannerincluding the expression Ps≈Pdz−Hpz.

As shown in Block 416, of FIG. 18, the fluid level Xc in the wellbore 39is then calculated in a manner substantially including the expressionXc≈(Ps−Pc)/Dc.

Once the fluid level Xc has been calculated for the wellbore, in themanner described above, in accordance with the exemplary method 400shown in FIG. 18, those having skill in the art will recognize that thecalculated fluid level Xc in the wellbore 39 may be utilized for otherpurposes, in accordance with the invention, such as controlling thecentrifugal pump 32, or for controlling the fluid level Xc in thewellbore 39. Even where the invention is utilized solely for determiningthe fluid level Xc, those skilled in the art will recognize that theinvention provides significant advantages over prior methods andapparatuses for determining fluid level Xc.

It should be noted, that calculations performed in the various steps ofthe exemplary embodiment 400 of the invention, described above, havebeen shown as being substantial equalities, in recognition of the factthat, in certain embodiments of the invention, it may be desirable toadd additional terms or constants to the basic exemplary equations shownin FIG. 18. It is further noted, however, that, in some embodiments, theinvention may be practiced with one or more of the calculations in thevarious steps of the method 400 being true, or assumed, equalities,without any additional terms or constants.

It will also be recognized, by those having skill in the art, that theaspect of the invention described in this section, for determining afluid level Xc of a wellbore, tank, etc., as a function of the inputspeed Up and input torque Tp of the centrifugal pump may also bepracticed in other forms, such as an apparatus, or a computer program,according to the invention.

It will be further noted, that due to the highly unstable nature of thefluid flow within the pump at speeds in the region of the zero-flowspeed Uz, some embodiments of the invention may further includeprovisions for offsetting the determined value of zero-flow speed Uz, orthe determined value of fluid level Xc, to improve accuracy of thedetermined fluid level, on the basis of other more direct measurementsof fluid level taken by more conventional methods, such as acoustic orlight reflection or soundings. Stated another way, experience has shownthat determining fluid level, according to the invention, provides ahighly repeatable and reliable method for precisely determining thefluid level Xc, within a degree of accuracy that is completelyacceptable for many applications of the invention. In applications ofthe invention where increased accuracy is required, it may be desirableto determine and incorporate an appropriate offset into determination ofthe fluid level Xc, through comparison of the value of Xc determinedaccording to the method described above with a verification measurementmade by traditional methods. Once the appropriate offset is determinedand included a method or apparatus, according to the invention, themethod of the invention can be relied upon for providing highlyreliable, repeatable, precise and accurate determinations of the fluidlevel Xc.

Fluid Level Feedforward Controller

Referring to FIG. 8, there is shown a process diagram of the fluid levelfeedforward controller 90. The fluid level feedforward controller 90uses flow head loss Hfe, pump head pressure Hre at rated speed and otherparameters to produce a motor speed feedforward command Muff to besummed with the motor speed feedback command Fuci in summing Block 79(FIG. 3 and FIG. 4) to produce the motor speed command Much for themotor vector controller 130. This speed signal is based on predictingthe pump speed required to maintain desired pressures, flows and levelsin the pumping system. Use of this controller reduces the amount offluid level error in the fluid level feedback controller 100 (FIG. 9),allowing conservative controller tuning and faster closed loop systemresponse.

More specifically, in scaling Block 91, the value of casing pressure Pcis scaled by the inverse of the casing fluid specific weight Dc toexpress the result in equivalent column height (head) of casing fluid.Similarly, in scaling Block 92, the value of tubing pressure Pt isscaled by the inverse of the tubing fluid specific weight Dt to expressthe result in equivalent column height (head) of tubing fluid. Insumming Block 93, the negative of the output of Block 91 is added to theoutput of Block 92, the pipe head flow loss Hfe, the depth of the pumpXp, and the negative of the commanded casing fluid level X-C to obtainpump head pressure command Hip. The flow head loss Hfe is the reductionin pressure due to fluid friction as calculated in Block 81 (FIG. 7).The commanded pump head Hip is the pressure that the pump must produceas a result of the inputs to summing Block 93. The values of casingpressure Pc and tubing pressure Pt can be measured in real time usingabove ground sensors in systems where they are variable or fixed forsystems where they are relatively constant. The values of pump depth Xpand commanded casing fluid level command X-C are known.

More specifically, in Block 94, the pump speed required to produce thepressure required by the head pressure command Hip is calculated bymultiplying the rated speed Ur by the square root of the ratio of thehead pressure command Hip to the head pressure at rated speed Hre toyield the motor speed feedforward command Umf. The value of headpressure at rated speed Hre is calculated by Block 65 of FIG. 5 or Block265 of FIG. 6 depending on the specific embodiment

Fluid Level Feedback Controller

Reference is now made to FIG. 9, which is a block diagram of a fluidlevel feedback controller 100 for the motor vector controller 130. Thefluid level feedback controller 100 includes a PID (proportional,integral, derivative) function that responds to errors between casingfluid level command Xcc and casing fluid level Xce to adjust the speedcommand for the pump 32. Operation of the fluid level feedforwardcontroller 90 provides a command based on the projected operation of thesystem. This assures that the errors to which the fluid level feedbackcontroller 100 must respond will only be the result of disturbances tothe system.

The inputs to the fluid level feedback controller 100 include casingfluid level command Xcc and a casing fluid level value Xce. The fluidlevel command Xcc is a known value and is subtracted from the casingfluid level value Xce in Block 101 to produce the error signal Xer forthe fluid level feedback controller 100.

The algorithm of the fluid level feedback controller 100 usesZ-transformations to obtain values for the discrete PID controller. Theterm Z−1 (Blocks 102 and 109) means that the value from the previousiteration is used during the current iteration.

More specifically, in summing Block 101, an error signal Xer is producedby subtracting Xcc from Xce. The speed command derivative error term Udcis calculated by subtracting, in summing Block 103, the current Xervalue obtained in Block 101 from the previous Xer term obtained fromBlock 102 and multiplying by the derivative gain Kd in Block 104. Thespeed command proportional error term Upc is calculated by multiplyingthe proportional gain Kp in Block 105 by the current Xer value obtainedin Block 101. The speed command integral error term Uic is calculated bymultiplying the integral gain Ki in Block 106 by the current Xer valueobtained in Block 101 and summing this value in Block 107 with theprevious value of Uic obtained from Block 109. The output of summingBlock 107 is passed through an output limiter, Block 108, to produce thecurrent integral error term Uic. The three error terms, Udc, Upc andUic, are combined in summing Block 110 to produce the speed command Ufcto be summed with the motor speed feedforward command Umf in summingBlock 79 (FIG. 3 and FIG. 4) for the motor vector controller 130.

Determining Pump Flow Rate without Using Motor Torque

FIG. 20 illustrates an exemplary embodiment of a method 500, accordingto the invention, for determining a flow rate Qp from a centrifugal pump32 operating at a selected pump speed Up, while disposed in a wellbore39 for transferring fluid within the wellbore 39, without using motortorque Tm, as a function of the selected operating speed Up and a fluidlevel Xc in the wellbore 39.

In the exemplary embodiment of the method 500, the centrifugal pump 32is connected to an outlet tubing system 38, of the well 30, asillustrated in FIGS. 1 and 14. The exemplary method 500 includescalculating the pump flow Qp by performing the steps, as shown in FIG.20, of: step 502, determining a combined characteristic equation for thecentrifugal pump 32 operating in a plumbing system disposed within andincluding the wellbore 39, in the form of the oil well 30 shown in FIG.1, as a function of the fluid level Xc in the wellbore 39; and step 506,solving the combined characteristic equation for the pump flow Qp as afunction of a selected pump speed Up.

As indicated graphically in FIG. 21, the combined characteristicequation will generally take the form of: (the static head of thesystem)+(the dynamic friction head loss of the system)=(pump curve). TheStep 502 of determining the combined characteristic equation may beaccomplished by any appropriate method. In one embodiment of theinvention, the combined characteristic equation may be determined byfitting a curve to system head loss equations according to aMoody/Darcy-Weisbach analysis, using pump flows within the operatingrange of the system. One form of such a curve fitting yields a combinedcharacteristic equation, substantially as follows, for the exemplaryembodiment of the oil well 30 illustrated in FIGS. 1 and 14:

${\left( {{Xp}*{Dt}*{Pt}} \right) - \left( {{Xc}*{Dc}*{Pc}} \right) + {{Hf}({Qp})}} = {\left( {{Qp}*\frac{Ur}{Up}} \right)\left( \frac{Up}{Ur} \right)^{2}}$

It will be noted that although the equation above, in the exemplaryembodiment, includes a squared term, in other embodiments of theinvention it may be desirable to use powers other than a perfect squareover the range of 1.5 to 2.5, or another appropriate power, inpracticing the invention.

In alternate embodiments of the invention, it may also be desirable todevelop a look-up table of values for determining the pump flow Qp,using appropriate empirical data and/or computational tools, rather thandeveloping and using the combined characteristic equation in the mannerdescribed above.

In the particular exemplary embodiment of the method 500, according tothe invention, shown in FIG. 20, the method 500 for determining pumpflow Qp further includes the step of determining a zero-flow speed Uz,as indicated in Block 508, to provide a lower bound on the solution ofthe combined characteristic equation, and determining casing fluid levelXc as indicated in Block 510.

The step 510 of determining casing fluid level Xc may be accomplished inany appropriate manner. Preferably, the fluid level Xc is determined inaccordance with the teachings of the present invention, as describedabove, but any other appropriate method may also be utilized, such asdirect measurement of the fluid level Xc, or estimation of fluid levelXc by any appropriate means such as through sonic reflectionmeasurements as is known in the art.

In similar fashion, the Step 508 of determining zero-flow speed Uz ofthe pump may be accomplished by any appropriate method including, butnot limited to, direct measurement with a flow meter, or any of themethods described herein with regard to practice of the presentinvention.

In one embodiment of the method 500, according to the invention,generally applicable for use in a system such as the exemplaryembodiment of the oil well 30, the zero flow speed Uz of the pump 32 maybe determined, in step 508, as a function of fluid level Xc, by solvingthe combined characteristic equation with pump flow Qp set to zero, insuch a manner that the following equation for determining zero-flow pumpspeed Uz(Xc), as a function of the fluid level Xc, is provided:

${{Uz}({Xc})} = {{Ur}\sqrt{\frac{\left( {{Xp}*{Dt}*{Pt}} \right) - \left( {{Xc}*{Dc}*{Pc}} \right)}{{Hr}\left( {{Qp} = 0} \right)}}}$

Once the fluid level Xc and the zero-flow speed Uz are known, thecombined characteristic equation determined in step 502 may be solvedfor the pump flow Qp at any pump speed Up greater than the zero-flowspeed Uz, using methods of ordinary skill in the art.

It will be noted that although the equation above includes a squareroot, in the exemplary embodiment, in other embodiments of the inventionit may be desirable to alternatively use roots over the range of 1.5 to2.5, for example, or any other appropriate root, in practicing theinvention.

As a practical matter, the exemplary embodiment of the method 500,according to the invention, shown in FIG. 20 limits solutions to thecombined characteristic equation to those values of pump speed Upgreater than the zero-flow speed Uz.

The calculated flow Q may be utilized for controlling the centrifugalpump 32 in any appropriate manner, such as for: optimizing performanceof the well optimizing energy efficiency, ensuring that adequate flowthrough the pump is provided for cooling and lubrication of the pump;and, for detecting problems in the system, such as a worn pump or leaksin the tubing.

Detecting the Onset of a Pump-Off and/or Gas-Lock Condition, and Controlfor Precluding Instigation of Pump-Off and/or Gas-Lock

FIG. 22 is a graphical illustration showing operation of an apparatus ormethod, according to the invention, for determining the onset of apump-off and/or gas-lock condition in a system according to theinvention, and for controlling a pump of the system in a manner allowingcontinued operation, at reduced speed, during recovery of the well fromthe pump-off and/or gas-lock condition.

FIG. 23 is a graphical illustration showing operation of an apparatus ormethod, according to the invention, for automatically determining, on aperiodic basis, a maximum pumping speed for continued operation of asystem according to the invention in a manner precluding instigation ofa pump-off and/or gas-lock condition during continuous operation of thesystem, and/or during recovery from a pump-off or gas-lock condition.

Vector Controller

Reference is now made to FIG. 10, which is a simplified block diagram ofthe motor vector controller 130. The motor vector controller 130contains functions for calculating the velocity error and the torquenecessary to correct it, convert torque commands to motor voltagecommands and current commands and calculate motor torque and speedestimates from measured values of motor voltages and motor currents.

In one embodiment, the stator flux is calculated from motor voltages andcurrents and the electromagnetic torque is directly estimated from thestator flux and stator current. More specifically, in Block 131,three-phase motor voltage measurements Vmm and current measurements 1 mmare converted to dq (direct/quadrature) frame signals using three to twophase conversion for ease of computation in a manner known in the art.Signals in the dq frame can be represented as individual signals or asvectors for convenience. The motor vector feedback model 132 responds tomotor stator voltage vector Vs and motor stator current vector Is tocalculate a measure of electrical torque Tme produced by the motor. Inone embodiment, the operations carried out by motor vector feedbackmodel 132 for calculating the electrical torque estimate are as follows.The stator flux vector Fs is obtained from the motor stator voltage Vsand motor stator current Is vectors according to equation (2):

Fs=(Vs−Is·Rs)/s  (2)

Fds=(Vds−Ids·Rs)/s  (2A)

Fqs=(Vqs−+Iqs·Rs)/s  (2B)

where Rs is the stator resistance and s (in the denominator) is theLaplace operator for differentiation. Equations (2A) and (2B) showtypical examples of the relationship between the vector notation forflux Fs, voltage Vs, and current Is and actual d axis and q axissignals.

In one embodiment, the electrical torque Tme is estimated directly fromthe stator flux vector Fs obtained from equation (2) and the measuredstator current vector Is according to equation (3) or its equivalent(3A):

Tme=Ku·( 3/2)·P·FsxIs  (3)

Tme=Ku·( 3/2)·P·(Fds·Iqs−Fqs·Ids)  (3A)

where P is the number of motor pole pairs and Ku is a unit scale factorto get from MKS units to desired units.

In one embodiment, rotor velocity Ume is obtained from estimates ofelectrical frequency Ue and slip frequency Us. The motor vector feedbackmodel 132 also performs this calculation using the stator voltage Vs andstator current Is vectors. In one embodiment, the operations carried outby the motor vector feedback model 132 for calculating the motorvelocity Ume are as follows. A rotor flux vector Fr is obtained from themeasured stator voltage Vs and stator current Is vectors along withmotor stator resistance Rs, stator inductance Ls, magnetizing inductanceLm, leakage inductance SigmaLs, and rotor inductance Lr according toequations (4) and (5); separate d axis and q axis rotor fluxcalculations are shown in equations (5A) and (5B) respectively:

SigmaLs=Ls−Lm̂2/Lr  (4)

then,

Fr=(Lr/Lm)·[Fs−Is·SigmaLs]  (5)

Fdr=(Lr/Lm)·(Fds−SigmaLs.Ids)  (5A)

Fqr=(Lr/Lm)·(Fqs−SigmaLs.Iqs)  (5B)

The slip frequency Us can be derived from the rotor flux vector Fr, thestator current vector Is, magnetizing inductance Lm, rotor inductanceLr, and rotor resistance Rr according to equation (6):

Us=Rr·(Lm/Lr)·[Fdr·Iqs−Fqr·Ids]  (6)

Fdr̂2+Fqr̂2

The instantaneous excitation or electrical frequency Ue can be derivedfrom stator flux according to equation (7):

Ue=Fds·sFqs−Fqs·sFds  (7)

Fdŝ2+Fqŝ2

The rotor velocity or motor velocity Ume can be derived from the numberof motor pole pairs P the slip frequency Us and the electrical frequencyUe according to equation (8):

Ume=(Ue−Us)(60)/P  (8)

In cases where long cable lengths or step up transformers are used, theimpedances of the additional components can be added to the model ofmotor impedances in a method that is known.

The velocity controller 133 uses a PI controller (proportional,integral), PID controller (proportional, integral, derivative) or thelike to compare the motor speed Ume with the motor speed command Umc andproduce a speed error torque command Tuc calculated to eliminate thespeed error. The speed error torque command Tuc is then converted tomotor current commands Imc and voltage commands Vmc in flux vectorcontroller 134 using a method which is known.

Referring to FIG. 15, in one preferred embodiment, the pump controlsystem provided by the present invention is software based and iscapable of being executed in a controller 50 shown in block diagram formin FIG. 13. In one embodiment, the controller 50 includes currentsensors 51, voltage sensors 52, input devices 171, such as analog todigital converters, output devices 172, and a processing unit 54 havingassociated random access memory (RAM) and read-only memory (ROM). In oneembodiment, the storage devices 55 include a database 175 and softwareprograms and files which are used in carrying out simulations ofcircuits and/or systems in accordance with the invention. The programsand files of the controller 50 include an operating system 176, theparameter estimation engines 177 that includes the algorithms for thepump model 60 (FIG. 5) or pump model 260 (FIG. 6) and the pump systemmodel 80 (FIG. 7), pump controller engines 178 that include thealgorithms for fluid level feedforward controller 90 (FIG. 8) and thefluid level feedback controller 100 (FIG. 9), and vector controllerengines 179 for the motor vector controller 130 for converting motorcurrent and voltage measurements to torque and speed estimates andconverting speed and torque feedforward commands to motor current andvoltage commands, for example. The programs and files of the computersystem can also include or provide storage for data. The processing unit54 is connected through suitable input/output interfaces and internalperipheral interfaces (not shown) to the input devices, the outputdevices, the storage devices, etc., as is known

Optimized Gas Production

The production of methane gas from coal seams can be optimized using theestimated parameters obtained by the pump controller 50 (FIG. 3 or FIG.4) in accordance with the invention. For methane gas production, it isdesirable to maintain the casing fluid level at an optimum level. Arange for casing fluid level command Xcc is selected to define anoptimal casing fluid level for extracting methane gas. This range iscommonly referred to as a sweet zone.

In one embodiment of the present invention, the selection of the sweetzone is determined by the controller 50 (FIG. 3 or FIG. 4) that searchesto find the optimum casing fluid level command Xcc. Since the sweet zonecan change as conditions in the well change over time, it can beadvantageous to program the controller 50 to perform these searches atperiodic intervals or when specific conditions, such as a decrease inefficiency, are detected. In determining the sweet zone, the centrifugalpump intake pressure Ps or casing fluid level Xc is controlled. Thecentrifugal pump 32 is controlled by the fluid level feedforwardcontroller 90 and the fluid level feedback controller 100 to cause thecasing fluid level Xc to be adjusted until maximum gas production isobtained. The casing fluid level command Xcc is set to a predeterminedstart value. The methane gas flow through outlet 42 at the surface ismeasured. The casing fluid level command is then repeatedly incrementedto progressively lower values. The methane gas production is measured ateach new level to determine the value of casing fluid level Xc at whichmaximum gas production is obtained. The point of optimum performance iscalled the sweet spot. The sweet zone is the range of casing fluid levelabove and below the sweet spot within which the gas production decreaseis acceptable. However, the selection of the sweet zone can be donemanually by taking readings.

Improved Pump Energy Efficiency and Operating Range

One method to optimize the pump control when operated at low flow and/orefficiency, is to operate using a duty cycle mode to produce therequired average flow rate while still operating the centrifugal pump atits most efficient and optimal flow rate point Qo. In this duty cyclemode, the volume of fluid to be removed from the casing can bedetermined using the fluid inflow rate Qi when the casing fluid level Xcis near the desired level. A fluid level tolerance band is definedaround the desired fluid level, within which the fluid level is allowedto vary. The volume Vb of the fluid level tolerance band is calculatedfrom the projected area between the tubing, casing and pump body and theprescribed length of the tolerance band. This volume is used with thefluid inflow rate Qi to determine the pump off time period Toff. Whenthe centrifugal pump is on, the value for casing fluid level Xc iscalculated and the fluid level in the casing is reduced to the lowerlevel of the fluid level tolerance band, when the pump is again turnedoff The fluid inflow rate Qi is calculated by dividing the fluid leveltolerance band volume Vb by the on time period Ton used to empty theband, then subtracting the result from the optimal pump flow rate Qoused to empty the band. The on-off duty cycle varies automatically toadjust for changing well inflow characteristics. This variable dutycycle continues with the centrifugal pump operating at its maximumefficiency over a range of average pump flow rates varying from almostzero to the flow associated with full time operation at the mostefficient speed. Use of the duty cycle mode also increases the range ofcontrollable pump average flow by using the ratio of on time, Ton,multiplied by optimal flow rate, Qo, divided by total cycle time(Ton+Toff) rather than the centrifugal pump speed to adjust averageflow. This also avoids the problem of erratic flow associated withoperating the pump at very low speeds. This duty cycle method canproduce significant energy savings at reduced average flow rates asshown in FIG. 16. As can be seen in FIG. 16, the efficiency of theexample pump using continuous operation decreases rapidly below about7.5 gallons per minute (GPM), while the efficiency of the same pumpoperated using the duty cycle method remains at near optimum efficiencyover the full range of average flow.

Pump system efficiency is determined by the ratio of the fluid poweroutput to the mechanical or electrical power input. When operated tomaximize efficiency, the controller turns the centrifugal pump off whenthe centrifugal pump starts operating in an inefficient range. Inaddition, the centrifugal pump is turned off if a pump off conditioncasing level at the pump intake is detected by a loss of measured flow.

For systems with widely varying flow demands, multiple centrifugalpumps, each driven by a separate motor, may be connected in parallel andstaged (added or shed) to supply the required capacity and to maximizeoverall efficiency. The decision for staging multiple centrifugal pumpsis generally based on the maximum operating efficiency or capacity ofthe centrifugal pump or combination of centrifugal pumps. As such, whena system of centrifugal pumps is operating beyond its maximum efficiencypoint or capacity and another centrifugal pump is available, acentrifugal pump is added when the efficiency of the new combination ofcentrifugal pumps exceeds the current operating efficiency. Conversely,when multiple centrifugal pumps are operating in parallel and the flowis below the combined maximum efficiency point, a centrifugal pump isshed when the resulting combination of centrifugal pumps have a betterefficiency. These cross-over points can be calculated directly from theefficiency data for each centrifugal pump in the system, whether theadditional centrifugal pumps are variable speed or fixed speed.

Pump and Pump System Protection

One method of protecting the centrifugal pump and system components isto use sensors to measure the performance of the system above ground andcompare this measurement to a calculated performance value. If the twovalues differ by a threshold amount, a fault sequence is initiated whichmay include such steps as activating an audio or visual alarm for theoperator, activating an alarm signal to a separate supervisorycontroller or turning off the centrifugal pump. In one embodiment, asensor is used to measure the flow in the tubing at the surface Qpm andcompare it with the calculated value Qpe. If the actual flow Qpm is toolow relative to the calculated flow Qpe, this could be an indication ofa fault such as a tubing leak, where not all of the flow through thecentrifugal pump is getting to the measurement point.

Another method of protecting the pump is to prevent excessive mechanicalpower input. In one embodiment, the mechanical power input to the pumpis calculated by multiplying the speed Ume by the torque Tme. The resultis compared to the mechanical input power limit Ple calculated by thepump model (FIG. 5 or FIG. 6). If the limit Ple is exceeded, the torqueand speed are reduced to protect the pump.

Although exemplary embodiments of the present invention have been shownand described with reference to particular embodiments and applicationsthereof, it will be apparent to those having ordinary skill in the artthat a number of changes, modifications, or alterations to the inventionas described herein may be made, none of which depart from the spirit orscope of the present invention. All such changes, modifications, oralterations should therefore be seen as being within the scope of thepresent invention.

All such changes, modifications, and alterations should therefore beseen as being within the scope of the present invention.

All references, including publications, patent applications, and patentscited herein are hereby incorporated by reference to the same extent asif each reference were individually and specifically indicated to beincorporated by reference and were set forth in its entirety herein.

The use of the terms “a” and “an” and “the” and similar referents in thecontext of describing the invention (especially in the context of thefollowing claims) is to be construed to cover both the singular and theplural, unless otherwise indicated herein or clearly contradicted bycontext. The terms “comprising,” “having,” “including,” and “containing”are to be construed as open-ended terms (i.e., meaning “including, butnot limited to,”) unless otherwise noted. Recitation of ranges of valuesherein are merely intended to serve as a shorthand method of referringindividually to each separate value falling within the range, unlessotherwise indicated herein, and each separate value is incorporated intothe specification as if it were individually recited herein. All methodsdescribed herein can be performed in any suitable order unless otherwiseindicated herein or otherwise clearly contradicted by context. The useof any and all examples, or exemplary language (e.g., “such as”)provided herein, is intended merely to better illuminate the inventionand does not pose a limitation on the scope of the invention unlessotherwise claimed. No language in the specification should be construedas indicating any non-claimed element as essential to the practice ofthe invention.

Preferred embodiments of this invention are described herein, includingthe best mode known to the inventors for carrying out the invention.Variations of those preferred embodiments may become apparent to thoseof ordinary skill in the art upon reading the foregoing description. Theinventors expect skilled artisans to employ such variations asappropriate, and the inventors intend for the invention to be practicedotherwise than as specifically described herein. Accordingly, thisinvention includes all modifications and equivalents of the subjectmatter recited in the claims appended hereto as permitted by applicablelaw. Moreover, any combination of the above-described elements in allpossible variations thereof is encompassed by the invention unlessotherwise indicated herein or otherwise clearly contradicted by context.

1. A method of determining a fluid level Xc in a wellbore, where thewellbore extends downward from a surface and has a centrifugal pumpdisposed therein for transferring fluid within the wellbore using acontroller operatively connected to the centrifugal pump, the methodcomprising: determining a zero-flow input speed Uz to the centrifugalpump at which output flow from the centrifugal pump is substantiallyzero; and using the zero-flow input speed Uz to calculate, with thecontroller, the fluid level Xc in the wellbore.
 2. The method of claim1, further comprising, determining the value of the zero-flow inputspeed Uz using the controller to the centrifugal pump at which theoutput flow from the centrifugal pump is substantially zero, withoutusing output flow from the centrifugal pump.
 3. The method of claim 2,further comprising, determining the zero-flow input speed Uz, bymonitoring input torque T to the centrifugal pump as input speed Up isreduced, and detecting the zero-flow input speed Uz as an input speed Upat which an incremental reduction in input speed Up is not accompaniedby a corresponding incremental reduction in input torque T.
 4. Themethod of claim 3, further comprising, determining a minimum desiredinput speed Umin of the pump which is greater than the zero-flow inputspeed Uz, and controlling the pump to operate only at speeds whereUp≧Umin, using the controller.
 5. The method of claim 3, furthercomprising, monitoring a change in torque dT and a change in input speeddU and calculating a quotient dT/dU of the change in torque dT dividedby the change in input speed dU, as the input speed Up is reduced, anddetermining Uz to be substantially a speed at which dT/dU achieves amaximum, using the controller.
 6. The method of claim 5, furthercomprising, monitoring dT/dU, as the input speed Up is reduced, anddetermining Uz to be a speed at which dT/dU falls below a selectedminimum value that is less than the maximum, using the controller. 7.The method of claim 5, wherein the selected minimum value of dT/dU issubstantially but not equal to zero.
 8. The method of claim 3, furthercomprising, using an affinity law for calculating a zero-flow pumpdifferential pressure Hpz at the zero-flow input speed Uz, and using thezero-flow pump differential pressure Hpz for calculating the fluid levelXc in the wellbore, using the controller.
 9. A method of controlling acentrifugal pump disposed in a wellbore extending downward from asurface and having a fluid level Xc therein, with the centrifugal pumpoperatively connected to a controller configured to control thecentrifugal pump, the pump including an output thereof connected to anoutput tube extending upward from the pump through the wellbore to thesurface, fluid within the wellbore defining a wellbore pressure Pc atthe surface, and fluid within the tube defining an internal pressure Ptof the fluid within the tube at the surface, the method comprising:determining values of input torque T and input speed Up to thecentrifugal pump; selecting a rated-operating input speed Ur of thecentrifugal pump, and determining a rated-output pressure Hr of thecentrifugal pump when producing output flow at the rated-operating inputspeed Ur and rated-output pressure Hr; determining a zero-flow inputspeed Uz of the centrifugal pump, without using output flow from thecentrifugal pump, by monitoring input torque T to the centrifugal pumpas input speed Up is reduced from the rated input speed Ur, anddetecting the zero-flow input speed Uz as an input speed Up at which anincremental reduction in input speed Up is not accompanied by acorresponding incremental reduction in input torque T; calculating azero-flow pump differential pressure Hpz at the zero-flow input speed Uzby multiplying the normal-operating output pressure Hr by the square ofthe quotient of the zero-flow input speed Uz divided by thenormal-operating input speed Ur, according to a calculationsubstantially including the mathematical expression Hpz≈Hr (Uz/Ur)̂2 withthe controller; determining values of the tube pressure Pt and wellborepressure Pc; calculating the zero-flow discharge pressure Hdz of thepump in a manner substantially including the expression Hdz≈(Dt*Xp)+Ptwith the controller; calculating an intake head pressure Hs of thecentrifugal pump, in a manner including the expression Hs≈Hdz−Hpz withthe controller; and calculating the fluid level Xc in the wellbore in amanner substantially including the expression Xc≈(Hs−Pc)/Dc with thecontroller.
 10. The method of claim 9, further comprising, using thecalculated fluid level Xc in the wellbore for controlling thecentrifugal pump.
 11. The method of claim 9, further comprising, usingthe calculated Xc in the wellbore for controlling the fluid level Xc inthe wellbore.
 12. The method of claim 9, wherein, the centrifugal pumpis operatively coupled to an electric motor having an electrical signaloperatively applied thereto, the method further comprises: monitoringthe electrical signal operatively supplied to the motor; and determiningvalues of input torque T and input speed Up to the centrifugal pump fromthe monitored electrical signal.
 13. An apparatus for controlling acentrifugal pump disposed in a wellbore extending downward from asurface and having a fluid level Xc therein, with the centrifugal pumpoperatively connected to a controller configured to control thecentrifugal pump, the pump including an output thereof connected to anoutput tube extending upward from the pump through the wellbore to thesurface, fluid within the wellbore defining a wellbore pressure Pc atthe surface, and fluid within the tube defining an internal pressure Ptof the fluid within the tube at the surface, the apparatus comprising:means for determining values of input torque T and input speed Up to thecentrifugal pump; means for selecting a rated-operating input speed Urof the centrifugal pump, and determining a rated-output pressure Hr ofthe centrifugal pump when producing output flow at the rated-operatinginput speed Ur and rated-output pressure Hr using the controller; meansfor determining a zero-flow input speed Uz of the centrifugal pump,without using output flow from the centrifugal pump, by monitoring inputtorque T to the centrifugal pump as input speed Up is reduced from therated input speed Ur, and detecting the zero-flow input speed Uz as aninput speed Up at which an incremental reduction in input speed U is notaccompanied by a corresponding incremental reduction in input torque T;means for calculating a zero-flow pump differential pressure Hpz at thezero-flow input speed Uz by multiplying the normal-operating outputpressure Hr by the square of the quotient of the zero-flow input speedUz divided by the normal-operating input speed Ur, according to acalculation substantially including the mathematical expression Hpz≈Hr(Uz/Ur)̂2 with the controller; means for determining values of the tubepressure Pt and wellbore pressure Pc; means for calculating the zeroflow discharge pressure Hdz of the pump in a manner substantiallyincluding the expression Hdz≈(Dt*Xp)+Pt with the controller; calculatingan intake head pressure Hs of the centrifugal pump, in a mannerincluding the expression Hs≈Hdz−Hpz with the controller; and calculatingthe fluid level Xc in the wellbore in a manner substantially includingthe expression Xc≈(Hs−Pc)/Dc with the controller.
 14. The apparatus ofclaim 13, further comprising, means for using the calculated fluid levelXc in the wellbore for controlling the centrifugal pump
 15. Theapparatus of claim 13, further comprising, means for using thecalculated Xc in the wellbore for controlling the fluid level Xc in thewellbore with the controller.
 16. The apparatus of claim 13, wherein,the centrifugal pump is operatively coupled to an electric motor havingan electrical signal operatively applied thereto, and the apparatusfurther comprises: means for monitoring the electrical signaloperatively supplied to the motor; and means for determining values ofinput torque T and input speed Up to the centrifugal pump from themonitored electrical signal.
 17. A method of determining a flow rate Qfrom a centrifugal pump operatively connected to a controller configuredto control the centrifugal pump, the pump operating at a selected pumpspeed Up while disposed in a wellbore for transferring fluid within thewellbore, the method comprising, calculating flow Q as a function of theselected speed Up and a fluid level Xc in the wellbore with thecontroller.
 18. The method of claim 17, further comprising, determiningthe fluid level Xc in the wellbore.